package com.watson.todolist.database;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * This class implements an authentication for the user name and password
 * attached to a gmail account.
 * 
 * @author Donnie Ward
 * 
 * @since 1.0
 * 
 */
class MailAuthenticator extends Authenticator {
	/**
	 * Gmail user name
	 */
	private String user;
	/**
	 * Gmail password
	 */
	private String password;

	/**
	 * @param username
	 *            - Gmail user name
	 * @param password
	 *            - Gmail password
	 */
	public MailAuthenticator(String username, String password) {
		super();
		this.user = username;
		this.password = password;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.mail.Authenticator#getPasswordAuthentication()
	 */
	public PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(user, password);
	}
}